include ../common/mixin.jade

-var items = [ {pro:"维修状态",content:"等待维修"},{pro:"报修时间",content:"2017年12月1日 23：57：31"},{pro:"上报人员",content:"钱博康 18086407838"},{pro:"故障类型",content:"错误代码568"}]

head
    +conf("网络报修")

body

#network
    +com-title("在线报修","历史记录","index-history.html")

    .weui-cells
        .weui-cell
            .weui-cell__hd
                label.weui-label 姓名
            .weui-cell__bd
                input.weui-input(name="base",value="钱博康")
        .weui-cell
            .weui-cell__hd 
                label.weui-label 宿舍
            .weui-cell__bd
                input.weui-input(name="base", value="竹枫斋 4舍", readonly="readonly")
        .weui-cell
            .weui-cell__hd
                label.weui-label 寝室号
            .weui-cell__bd
                input.weui-input(name="base", value="227")        
        .weui-cell
            .weui-cell__hd
                label.weui-label 手机号
            .weui-cell__bd
                input.weui-input(name="tel", value="18086407838") 
        .weui-cell
            .weui-cell__hd
                label.weui-label 错误类型
            .weui-cell__bd
                input.weui-input(name="err", placeholder="选择故障类型（必选）",readonly="readonly")
        .weui-cell
            .weui-cell__bd
                textarea.weui-textarea(name="err", placeholder="请详细描述故障情况（必填）", rows="6")

    .weui-btn-area
        a.weui-btn.weui-btn_primary(onclick="Info()") 提交


    script.
        var net={ "base":"", "tel":"", "err":"" };


        function getDorm(){
            weui.picker([
                { label: '桂檀斋'}, 
                { label: '竹枫斋'},
                { label: '椿萱斋'}, 
                { label: '梅菊斋'}
            ], [
                { label: '1舍'}, 
                { label: '2舍'}, 
                { label: '3舍'},
                { label: '4舍'}
            ], {
                onConfirm: function (result) {
           
                    var dorm=result[0].label;
                    var dorm_num=result[1].label;

                    var str = dorm +" "+dorm_num;
                    base[1].value= str;
                }
            });
        }

        function getErr__number(){
            weui.picker([
                { label: '登录提示错误代码651'}, 
                { label: '登录提示错误代码691,629'},
                { label: '登录提示错误代码734'}, 
                { label: '其他错误代码，请在描述里标明'},
                { label: '网速慢，不稳定'},
                { label: '网线接口有问题'}
            ],{
                onConfirm: function (result) {
                    err[0].value= result[0].label;
                }
            });
        }        

      
        window.onload=function(){

            // base 监听事件
            base = document.getElementsByName("base");
            tel = document.getElementsByName("tel");
            err = document.getElementsByName("err");

            base[1].onclick=getDorm;
            err[0].onclick=getErr__number;

        }

        function Info(){
            net.base = base[0].value + " " + base[1].value + " " + base[2].value;

            net.tel = tel[0].value;

            net.err = err[0].value + err[1].value;

            // 是否填充
            if(!(net.base&&net.tel&&net.err)){
                weui.dialog({
                    content: "您有未填的内容",
                    className: 'custom-classname',
                    buttons: [ {
                        label: '确定',
                        type: 'default'
                    }]
                  });
                }
            else {
                weui.toast('报修成功', 1500);
              }
            }

    +footer